package com.atstudy.coll;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2022/12/30 16:20
 * @copyright: 博为峰
 */
public class CollectionDemo {
    public static void main(String[] args) {
//        m1();
//        m2();
//        m3();
        m4();
    }

    //查
    private static void m4() {
        Collection collection = new ArrayList();
        collection.add("b");
        collection.add("w");
        collection.add("f");
        System.out.println(collection.size());
    }

    //判断
    private static void m3() {
        Collection collection = new ArrayList();
        collection.add("b");
        collection.add("w");
        collection.add("f");
        System.out.println(collection.contains("w"));//包含
        System.out.println(collection.isEmpty());//是否空
    }

    //删
    private static void m2() {
        Collection collection = new ArrayList();
        collection.add("b");
        collection.add("w");
        collection.add("f");
//        collection.remove("w");
        collection.clear();//清空
        System.out.println(collection);
    }

    //增
    private static void m1() {
        Collection collection = new ArrayList();
        collection.add("b");
        collection.add("w");
        collection.add("f");
        System.out.println(collection);
    }
}
